package registration.adventurezone.thevine.com;

import android.util.Log;

public class StringUtils {
	public static String parsePhoneNumber(String number) {
		String phone = "";
		if(number != null) {
			if(validatePhoneNumber(number)) {
				phone = "(" + number.substring(0, 3) + ") " + number.substring(3, 6) + "-" + number.substring(6, 10);
			}
			else {
				Log.e("Error:", "The given input is not a valid phone number.  Needs to be exactly 10 digits.");
			}
			
		}
		
		return phone;
		
	}
	private static boolean validatePhoneNumber(String number) {
		if(number.matches("^[0-9]{10}$"))
			return true;
		return false;
			
	}
}
